home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / HackAddict™ Magazine / HA 1-12 / HackAddict08.sit / HackAddict 8 ƒ / HackAddict™ 8.rsrc / TEXT_137.txt < prev    next >
Text File  |  1997-11-30  |  7KB  |  161 lines

  1.  Appendix A: List of Assembly 
  2.        Language Commands
  3.  
  4.  
  5.  
  6. Addressing Modes
  7.  
  8. - Data register direct addressing:
  9.     add.b        D0,D1        : adds the value in D0 to D1
  10.  
  11. - Address register direct addressing:
  12.     add.l        D0,A1        : adds value D0 to A1
  13.  
  14. - Address register indirect addressing:
  15.     move.l    (A1),D7    : moves contents of address to data register 
  16.   e.g. if A1 contained $1111, and the address $1111 contains 00001234 then after the operation 00001234 would be loaded in data register 7 (D7).
  17.     move.l    D7,(A1)    : moves number value of D7 into the location pointed to by A1.
  18.  
  19. - Address register indirect with post increment:
  20.     move.l     D7,(A1)+    : moves the long in D7 to memory location in A1 then adds 4 to A1 (because the data item was a long). With other words after the move, it increments the address register by the size of the data
  21.     move.l    (A0)+,(A1)+    : moves four bites from memory location in A0 to memory location in A1 then adds four to A0 and A1
  22.  
  23. - Address register indirect addressing with pre decrement:
  24.     move.b    D0, -(A1)    : decrement A1 by one (because it‚Äôs a byte) then move word in D0 to the address held in A1
  25. (When bytes are moved onto the STACK then the stack pointer changes by 2 because words and longs have to be moved to even addresses)
  26.  
  27. - Address register indirect addressing with displacement:
  28.     move.w    D0,4(A1)    : move word in D0 to the memory location in A1+4.
  29.   e.g. if D0 consists of 01 and A1 contains $1000 then 01 will be moved to address $1004
  30.     move.l    -2(A1),D0    : moves long at A1-2 to D0
  31. (offset has to be a 16 bit word- max value=32768, min value -32767)
  32.  
  33. - Address register indirect addressing with index:
  34.     move.w    69(A1,D0.l),D1:     moves data word from address A1+D0+69 to D1.
  35. (displacement must fit in a byte, >-127, <128)
  36.  
  37. - Absolute short addressing:
  38.     move.w    69,D0        : moves word at ADDRESS 69 to D0
  39.  
  40. - Immediate mode addressing:
  41.     move.w    #69,D0    : move NUMBER 69 into D0
  42.  
  43. - Absolute long addressing:
  44.     move.w    D0,$69000    : moves word from D0 to address $69000
  45.  
  46. - Program counter addressing with displacement:
  47.     move.w    12(pc),D0    : move word 12 bytes from current location to D0
  48.  
  49. - Program counter addressing with index:
  50.     move.l    69(pc,D0.l),D1    : move data from 69+ current location + D0.l into D1
  51. (displacement must fit into a byte)
  52.  
  53. - Status register addressing:
  54.     move.w    #69,sr        : move number 69 into status register
  55. (to use status register a WORD needs to be moved)
  56.     move.b     #0,ccr        : move 0 to condition code register
  57.  
  58.  
  59. Instructions
  60.  
  61. Arithmetic Instructions:
  62.  
  63.  - ADD - Adds two operands. One operand must be a data register.  
  64.  - ADDA - Adds an operand to an address register.  
  65.  - ADDI - Adds a real number to an operand.   
  66.  - ADDQ - Adds a number between zero and eight to an operand.  
  67.  - ADDX - Allows adding of numbers of any length.  
  68.  - SUB  - Subtracts source operand from destination operand.
  69.  - SUBA - Subtracts the source operand from an address register.  
  70.  - SUBI - Subtracts a real number from the destination operand.  
  71.  - SUBQ - Subtracts a number between zero and eight from a destination operand.   
  72.  - SUBX - Allows subtraction of numbers of any length- CLR  - Clears an operand.  
  73.  - MULS - Multiplies destination operand by source operand using signed arithmetic. 
  74.  - MULU - Multiplies destination operand by source operand using unsigned arithmetic
  75.  - DIVS - Divides destination operand by source operand using signed arithmetic.   
  76.  - DIVU - Divides destination operand by source operand using unsigned arithmetic. 
  77.  - NEG  - Negates a number.
  78.  - CMP  - Compares two operands and sets condition code flags.   
  79.  - CMPA - Compares an operand to an address register then sets the condition code flags.  
  80.  - CMPI - Compares a real number to an operand then sets the condition flags.  
  81.  - CMPM - Compares contents of two memory locations using post increment addressing mode.  
  82.  - TAS - Test a byte and sets the high order bit.  
  83.  - TST  - Tests an operand - compares it to zero.
  84.  - EXT  - Sign extend a byte or word to word or long respectively.
  85.  
  86. Program Control Instructions
  87.  
  88.     BCC - branch if the carry bit is clear. (a zero)
  89.     BCS - branch if the carry bit is set. (a one)  
  90.     BEQ - branch if equal. 
  91.     BGE - Branch if greater than or equal. 
  92.     BGT - Branch if greater than.  
  93.     BHI - Branch if higher than. Used on unsigned numbers. 
  94.     BLE - Branch if less than or equal.  
  95.     BLS - Branch if lower than or the same. Used on unsigned numbers.  
  96.     BLT - Branch if less than. 
  97.     BMI - Branch if minus. 
  98.     BNE - Branch if not equal. 
  99.     BPL - Branch if plus.  
  100.     BVC - Branch if the V bit is clear. (no overflow)
  101.     BVS - Branch if the V bit is set. (overflow) 
  102.     BRA - Always branch. 
  103.  
  104.  - DBcc - Decrement then branch if condition is met.  
  105.  - Scc - Set if condition is met.   
  106.  - BSR - Branch to subroutine.   
  107.  - JSR - Jump to subroutine.   
  108.  - RTS - Return from subroutine.   
  109.  - JMP - Jump to an absolute memory location.  
  110.  - RTR - Restores the program counter and condition codes from the stack.   
  111.  
  112. Logical Operation Instructions
  113.  
  114.  - AND - Does  AND operation with the operands.   
  115.  - ANDI - Does AND operation with a real number and an operand.   
  116.  - OR - Does OR operation with the operands.
  117.  - ORI - Does OR with a real  number and an operand.   
  118.  - EOR -  Does Exclusive OR with two operands.  
  119.  - EORI - Does Exclusive OR with operand and a real number.
  120.  - NOT  - Inverts an operand.        
  121.  
  122. Data Movement Instructions
  123.  
  124.  - EXG - Exchange contents of two registers. 
  125.  - LEA - Load Effective Address. Calculate a memory address and store it in an address register.   
  126.  - LINK - Allocates a stack frame.   
  127.  - MOVE - Move source operand into destination operand.  
  128.  - MOVEM - Transfers multiple register to and from memory.  
  129.  - MOVEP - Transfers data to and from an eight bit peripheral.  
  130.  - MOVEQ - Loads a data register with a number in the range of +- 128.  
  131.  - PEA - Same as LEA, but pushes the address onto the stack.  
  132.  - SWAP - Swaps the words of a data register. The high word becomes the low and the low the high.  
  133.  - UNLK - Unallocates a stack frame.        
  134.  
  135. Shifting and Rotating Instructions
  136.  
  137.  - ASL and ASR - Arithmetic shift left or right.   
  138.  - LSL and LSR - Logical shift left or right.    
  139.  - ROL and ROR - Rotate left or right.  
  140.  - ROXL and ROXR - Rotate with the carry bit left or right.     
  141.  
  142. Bit Manipulating Instructions
  143.  
  144.  - BTST - tests a single bit.   
  145.  - BSET - set a single bit.   
  146.  - BCLR - clear a single bit.   
  147.  - BCHG - change a single bit.    
  148.  
  149. System Control instructions
  150.  
  151.  - MOVE USP - Move an operand to user stack pointer.   
  152.  - RESET - Reset external peripherals.    
  153.  - RTE - Return from an exception.  
  154.  - STOP - Stop processing until an exception occurs.   
  155.  - TCHK - Check an operand against boundaries - used to prevent serious software errors.  
  156.  - TRAP - 16 instructions that provide a method for user program to call a supervisor mode program.
  157.  
  158.  
  159.  
  160.  
  161. ProZaq